﻿using System;
using UnityEngine;

namespace UniRx.Triggers
{
	// Token: 0x02000430 RID: 1072
	[DisallowMultipleComponent]
	public class ObservableEnableTrigger : ObservableTriggerBase
	{
		// Token: 0x06001663 RID: 5731 RVA: 0x000617AC File Offset: 0x0005FBAC
		private void OnEnable()
		{
			if (this.onEnable != null)
			{
				this.onEnable.OnNext(Unit.Default);
			}
		}

		// Token: 0x06001664 RID: 5732 RVA: 0x000617CC File Offset: 0x0005FBCC
		public IObservable<Unit> OnEnableAsObservable()
		{
			Subject<Unit> result;
			if ((result = this.onEnable) == null)
			{
				result = (this.onEnable = new Subject<Unit>());
			}
			return result;
		}

		// Token: 0x06001665 RID: 5733 RVA: 0x000617F4 File Offset: 0x0005FBF4
		private void OnDisable()
		{
			if (this.onDisable != null)
			{
				this.onDisable.OnNext(Unit.Default);
			}
		}

		// Token: 0x06001666 RID: 5734 RVA: 0x00061814 File Offset: 0x0005FC14
		public IObservable<Unit> OnDisableAsObservable()
		{
			Subject<Unit> result;
			if ((result = this.onDisable) == null)
			{
				result = (this.onDisable = new Subject<Unit>());
			}
			return result;
		}

		// Token: 0x06001667 RID: 5735 RVA: 0x0006183C File Offset: 0x0005FC3C
		protected override void RaiseOnCompletedOnDestroy()
		{
			if (this.onEnable != null)
			{
				this.onEnable.OnCompleted();
			}
			if (this.onDisable != null)
			{
				this.onDisable.OnCompleted();
			}
		}

		// Token: 0x04000C99 RID: 3225
		private Subject<Unit> onEnable;

		// Token: 0x04000C9A RID: 3226
		private Subject<Unit> onDisable;
	}
}
